var search_goods = {

	item 	: false,

	/*****
	搜索货物方法
	@text:string 搜索框输入的内容
	@callback:function 回调函数
	*****/
	search : function(text, callback)
	{
		reg = new RegExp('^[0-9A-z-_]*$');
		if (reg.exec(text) && text.length > 1)
		{
			if ('object' == typeof stock.ajax)
			{
				stock.ajax.abort();
			}
			url = site.url + 'stock/search/';
			data = tool.toJson('{"q":"' + text + '"}');
			style.loading('start');
			stock.ajax = $.post(url, data, function(result){
				//alert(result);
				j = tool.toJson(result);
				if ('ERROR' != j.r)
				{
					search_goods.set_item(j.d);
					if (callback)
					{
						callback();
					}
				}
				else
				{
					tool.customAlert({'obj':'搜索失败'});
				}
				style.loading('end');
			})
		}
	},

	from_sub_goods_id : function()
	{

	},

	//返回获取项目的Json值
	set_item : function(data)
	{
		search_goods.item = data;
	}

}